package io.kiki.sba.registry.remoting.netty;


import io.kiki.sba.registry.api.Callback;
import io.kiki.sba.registry.api.Channel;

import java.util.concurrent.Executor;

public final class InvokeCallbackHandler implements io.kiki.stack.netty.invoker.Callback {
    private final Channel channel;
    private final Callback callback;

    public InvokeCallbackHandler(Channel channel, Callback callback) {
        this.channel = channel;
        this.callback = callback;
    }


    @Override
    public void onSuccess(Object o) {
        callback.onSuccess(channel, o);
    }

    @Override
    public void onFailed(Throwable throwable) {
        callback.onFailed(channel, throwable);
    }

    @Override
    public Executor getExecutor() {
        return callback.getExecutor();
    }
}
